﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Manson.AuthorizationDemo
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();
            SysStartTime = DateTime.Now;
            myTimer.Interval = 500;
            myTimer.Tick += MyTimer_Tick;
            myTimer.Start();
        }

        private void MyTimer_Tick(object sender, EventArgs e)
        {
            if (Program.IsLicenced == false)
            {
                if (DateTime.Now.Subtract(SysStartTime).TotalSeconds >= 60)
                {
                    myTimer.Enabled = false;
                    MessageBox.Show("软件授权到期，即将关闭系统！", "授权提示");
                    this.Close();
                }
            }
        }

        private Timer myTimer = new Timer();

        private DateTime SysStartTime;
    }
}
